package com.alks.common.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: chen
 * @date: 2024/11/22
 * @description: 星期名称中英互译
 */
public class WeekdayTranslator {

    private static final Map<String, String> cnToEnMap = new HashMap<>();
    private static final Map<String, String> enToCnMap = new HashMap<>();

    static {
        cnToEnMap.put("星期一", "Monday");
        cnToEnMap.put("星期二", "Tuesday");
        cnToEnMap.put("星期三", "Wednesday");
        cnToEnMap.put("星期四", "Thursday");
        cnToEnMap.put("星期五", "Friday");
        cnToEnMap.put("星期六", "Saturday");
        cnToEnMap.put("星期日", "Sunday");

        enToCnMap.put("Monday", "星期一");
        enToCnMap.put("Tuesday", "星期二");
        enToCnMap.put("Wednesday", "星期三");
        enToCnMap.put("Thursday", "星期四");
        enToCnMap.put("Friday", "星期五");
        enToCnMap.put("Saturday", "星期六");
        enToCnMap.put("Sunday", "星期日");
    }

    public static String translateCnToEn(String cnWeekday) {
        return cnToEnMap.getOrDefault(cnWeekday, "Invalid Chinese weekday");
    }

    public static String translateEnToCn(String enWeekday) {
        return enToCnMap.getOrDefault(enWeekday, "Invalid English weekday");
    }

}
